﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace AddFileHeaders
{
    internal partial class FilterControl : UserControl
    {

        public event EventHandler AddFilter;
        
        public FilterControl()
        {
            InitializeComponent();
        }

        private void btnAddFileType_Click(object sender, EventArgs e)
        {
            if (this.txtFileType.Text.Length == 0)
            {
                this.lblEmpty.Visible = true;
            }
            else
            {
                this.OnFilterAdded(new FileTypeFilter(this.txtFileType.Text), new EventArgs());
                this.Hide();
            }
        }

        public virtual void OnFilterAdded(object sender, EventArgs e)
        {
            if (this.AddFilter != null) { this.AddFilter(sender, e); }
        }

    }
}
